import React from 'react';
import * as asyncLoad from '../util/asyncLoad';
import { smsFiles } from '../constants/fileConfig';
import Loading from './Loading';
import { getAntd,getEcCom,getLabel } from '../util/convert';

export default class SendSms extends React.Component{
    constructor(){
        super();
        this.state = {hasLoad: false};
    }
    componentDidMount(){
        const init = () =>{
            this.setState({hasLoad:true});
        }
        asyncLoad.asyncLoadModule('sms', smsFiles, init);
    }
    render(){
        const { WeaDialog } = getEcCom();
        const { hasLoad } = this.state;
        if(hasLoad){
            const { SendSms } = window.weaSmallApp.com;
            const { visible,params,closeFun } = this.props;
            return (
                <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@l2fnqh`}
                    visible={visible}
                    title={getLabel(16635,'发送短信')}
                    icon="icon-coms-workflow"
                    iconBgcolor='#0079DE'
                    className="wf-send-sms"
                    maskClosable={false}
                    onCancel={()=>{closeFun()}}
                    style={{width:"800px", height:"450px"}}
                >
                    <SendSms ecId={`${this && this.props && this.props.ecId || ''}_SendSms@zrpr3s`} isCus={true} params={params} closeFun={()=>{closeFun()}} />
                </WeaDialog>
            );
        }else{
            return (<Loading ecId={`${this && this.props && this.props.ecId || ''}_Loading@fubg94`} />);
        }
        
    }
}